import axios from '@/libs/api.request'
import config from '@/config'

export const getFlowTable = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'FinancialService.accountView',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const getAccountBalance = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'FinancialService.accountValue',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const getSaleCount = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'FinancialService.saleCount',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const getAccountFundingMessage = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'AdminService.chargeRequestView',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const getFundingTable = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'AdminService.accountView',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const editFundingRecord = async (playload) => {
  const data = {
    module: 'AdminService.moneyUpdate',
    ...playload
  }
  const resp = await axios.request({
    url: config.postUrl,
    data,
    method: 'post'
  })
  return resp
}

export const chargeRequest = async (playload) => {
  const data = {
    module: 'FinancialService.chargeRequest',
    ...playload
  }
  const resp = await axios.request({
    url: config.postUrl,
    data,
    method: 'post'
  })
  return resp
}

export const getFundingRecordTable = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'AdminService.chargeView',
      ...playload
    },
    method: 'get'
  })
  return resp
}
